/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Demo;
import java.io.*;
/**
 *
 * @author Christian
 */
public class Deserializar {
    public static void main(String[] args){
        Agenda a1= null;
        Agenda a2= null;

        try{
            //para abrir o recuperar un archivo de disco
            FileInputStream fis = new FileInputStream("agenda2.ser");
            ObjectInputStream ois = new ObjectInputStream(fis);
            //readobject recupera el objeto
            a1 = (Agenda) ois.readObject();
            a2 = (Agenda) ois.readObject();
            ois.close();
        }
        catch(FileNotFoundException e){e.printStackTrace();}
        catch(IOException e){e.printStackTrace();}
        catch(ClassNotFoundException e){e.printStackTrace();}

        System.out.println(a1);
        System.out.println(a2);
    }

}
